package component

import (
	"github.com/spf13/viper"
)

func InitConfig(path, file, types string) (*viper.Viper, error) {
	v := viper.New()
	v.AddConfigPath(path)
	v.SetConfigName(file)
	v.SetConfigType(types)
	err := v.ReadInConfig()
	if err != nil {
		return nil, err
	}
	return v, nil
}
